from django.db import models

# Create your models here.

# 游戏角色
class Game(models.Model):
    name = models.CharField(max_length=200, verbose_name='角色')
    pwd = models.CharField(max_length=200, verbose_name='密码')
    grade = models.IntegerField(default=1, verbose_name='等级')
    life = models.IntegerField(default=10, verbose_name='生命值')
    agg = models.IntegerField(default=1, verbose_name='攻击力')
    defe = models.IntegerField(default=1, verbose_name='防御力')
    exp = models.IntegerField(default=0, verbose_name='经验值')

    class Meta:
        db_table = 'game'

# 装备表
class Equipment(models.Model):
    name = models.CharField(max_length=30, verbose_name='装备名称')
    content = models.IntegerField(verbose_name='属性,0攻击力+,1防御力+')
    agg_defe = models.IntegerField(verbose_name='0攻击力+,1防御力+')

    class Meta:
        db_table = 'equipment'

# 武器表
class Prop(models.Model):
    name = models.CharField(max_length=30, verbose_name='道具名称')
    content = models.IntegerField(verbose_name='属性,0攻击力+,1防御力+')
    agg_defe = models.IntegerField(verbose_name='0攻击力+,1防御力+')

    class Meta:
        db_table = 'prop'
# 背包
class Knapsack_z(models.Model):
    game_id = models.ForeignKey(Game,on_delete=models.CASCADE,related_name='gamez')
    equipment_id = models.ForeignKey(Equipment,on_delete=models.CASCADE,related_name='equipment')
    class Meta:
        db_table = 'knapsack_z'

# 武器背包
class Knapsack_d(models.Model):
    game_id = models.ForeignKey(Game, on_delete=models.CASCADE, related_name='gamed')
    prop_id = models.ForeignKey(Prop, on_delete=models.CASCADE, related_name='prop')

    class Meta:
        db_table = 'knapsack_d'

# 装备背包
class Knapsack(models.Model):
    game_id = models.ForeignKey(Game, on_delete=models.CASCADE, related_name='game')
    equipment_id = models.ForeignKey(Knapsack_d, on_delete=models.CASCADE, related_name='zhuang')

    class Meta:
        db_table = 'knapsack'





















